package com.yami.shop.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.app.dto.CouponRecordDto;
import com.yami.shop.bean.model.CouponRecord;
import com.yami.shop.dao.CouponRecordMapper;
import com.yami.shop.service.CouponRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CouponRecordServiceImpl extends ServiceImpl<CouponRecordMapper, CouponRecord> implements CouponRecordService {

    @Autowired
    private CouponRecordMapper couponRecordMapper;

    @Override
    public List<CouponRecord> selectValidCoupon(CouponRecord couponRecord) {
        return couponRecordMapper.selectValidCoupon(couponRecord);
    }

    @Override
    public List<CouponRecord> getByUserIdAndShopId(CouponRecord couponRecord) {
        return couponRecordMapper.getByUserIdAndShopId(couponRecord);
    }

    @Override
    public List<CouponRecordDto> selectUseCouponRecord(CouponRecord couponRecord){
        return couponRecordMapper.selectUseCouponRecord(couponRecord);
    }

    @Override
    public List<CouponRecordDto> getCouponAndRecord(Long recordId){
        return couponRecordMapper.getCouponAndRecord(recordId);
    }

    @Override
    public CouponRecord getAvailableCouponByUserId(Long couponId, String userId) {
        return couponRecordMapper.getAvailableCouponByUserId(couponId,userId);
    }

}
